import Vue from 'vue';
import Router from 'vue-router';
import { AuthGuard } from '@/utils';
import qs from 'qs';
import { globalRoutes, indexRoutes} from '@/router'

Vue.use(Router);

const router = new Router({
    routes: [
        {
            path: '/index/:index?',
            beforeEnter: (to: any, from: any, next: any) => {
                const routerParamsName = 'index';
                const params: any = {};
                if (to.params && to.params[routerParamsName]) {
                    Object.assign(params, qs.parse(to.params[routerParamsName], { delimiter: ';' }));
                }
                const url: string = '/appdata';
                const auth: Promise<any> = AuthGuard.getInstance().authGuard(url, params, router);
                auth.then(() => {
                    next();
                }).catch(() => {
                    next();
                });
            },
            meta: {  
                caption: 'app.views.index.caption',
                info:'',
                viewType: 'APPINDEX',
                parameters: [
                    { pathName: 'index', parameterName: 'index' },
                ],
                requireAuth: true,
            },
            component: () => import('@pages/pms/index/index.vue'),
            children: [
                {
                    path: 'projects/:project?/tasks/:task?/tabexpview/:tabexpview?',
                    meta: {
                        caption: 'entities.task.views.tabexpview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'projects', parameterName: 'project' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'tabexpview', parameterName: 'tabexpview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-tab-exp-view/task-tab-exp-view.vue'),
                },
                {
                    path: 'tasks/:task?/tabexpview/:tabexpview?',
                    meta: {
                        caption: 'entities.task.views.tabexpview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'tabexpview', parameterName: 'tabexpview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-tab-exp-view/task-tab-exp-view.vue'),
                },
                {
                    path: 'projects/:project?/infodashboardview/:infodashboardview?',
                    meta: {
                        caption: 'entities.project.views.infodashboardview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'projects', parameterName: 'project' },
                            { pathName: 'infodashboardview', parameterName: 'infodashboardview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/project-info-dashboard-view/project-info-dashboard-view.vue'),
                },
                {
                    path: 'actions/:action?/editview/:editview?',
                    meta: {
                        caption: 'entities.action.views.editview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'actions', parameterName: 'action' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/action-edit-view/action-edit-view.vue'),
                },
                {
                    path: 'projects/:project?/simpleeditview/:simpleeditview?',
                    meta: {
                        caption: 'entities.project.views.simpleeditview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'projects', parameterName: 'project' },
                            { pathName: 'simpleeditview', parameterName: 'simpleeditview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/project-simple-edit-view/project-simple-edit-view.vue'),
                },
                {
                    path: 'projects/:project?/tasks/:task?/closedgridview/:closedgridview?',
                    meta: {
                        caption: 'entities.task.views.closedgridview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'projects', parameterName: 'project' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'closedgridview', parameterName: 'closedgridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-closed-grid-view/task-closed-grid-view.vue'),
                },
                {
                    path: 'tasks/:task?/closedgridview/:closedgridview?',
                    meta: {
                        caption: 'entities.task.views.closedgridview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'closedgridview', parameterName: 'closedgridview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-closed-grid-view/task-closed-grid-view.vue'),
                },
                {
                    path: 'projects/:project?/tasks/:task?/mytasklistview/:mytasklistview?',
                    meta: {
                        caption: 'entities.task.views.mytasklistview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'projects', parameterName: 'project' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'mytasklistview', parameterName: 'mytasklistview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-my-task-list-view/task-my-task-list-view.vue'),
                },
                {
                    path: 'tasks/:task?/mytasklistview/:mytasklistview?',
                    meta: {
                        caption: 'entities.task.views.mytasklistview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'mytasklistview', parameterName: 'mytasklistview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-my-task-list-view/task-my-task-list-view.vue'),
                },
                {
                    path: 'actions/:action?/taskactionlistview/:taskactionlistview?',
                    meta: {
                        caption: 'entities.action.views.taskactionlistview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'actions', parameterName: 'action' },
                            { pathName: 'taskactionlistview', parameterName: 'taskactionlistview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/action-task-action-list-view/action-task-action-list-view.vue'),
                },
                {
                    path: 'projects/:project?/tasks/:task?/infodashboardview/:infodashboardview?',
                    meta: {
                        caption: 'entities.task.views.infodashboardview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'projects', parameterName: 'project' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'infodashboardview', parameterName: 'infodashboardview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-info-dashboard-view/task-info-dashboard-view.vue'),
                },
                {
                    path: 'tasks/:task?/infodashboardview/:infodashboardview?',
                    meta: {
                        caption: 'entities.task.views.infodashboardview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'infodashboardview', parameterName: 'infodashboardview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-info-dashboard-view/task-info-dashboard-view.vue'),
                },
                {
                    path: 'projects/:project?/listview/:listview?',
                    meta: {
                        caption: 'entities.project.views.listview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'projects', parameterName: 'project' },
                            { pathName: 'listview', parameterName: 'listview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/project-list-view/project-list-view.vue'),
                },
                {
                    path: 'projects/:project?/tasks/:task?/listview/:listview?',
                    meta: {
                        caption: 'entities.task.views.listview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'projects', parameterName: 'project' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'listview', parameterName: 'listview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-list-view/task-list-view.vue'),
                },
                {
                    path: 'tasks/:task?/listview/:listview?',
                    meta: {
                        caption: 'entities.task.views.listview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'listview', parameterName: 'listview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-list-view/task-list-view.vue'),
                },
                {
                    path: 'projects/:project?/tasks/:task?/dashboardview/:dashboardview?',
                    meta: {
                        caption: 'entities.task.views.dashboardview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'projects', parameterName: 'project' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'dashboardview', parameterName: 'dashboardview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-dashboard-view/task-dashboard-view.vue'),
                },
                {
                    path: 'tasks/:task?/dashboardview/:dashboardview?',
                    meta: {
                        caption: 'entities.task.views.dashboardview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'dashboardview', parameterName: 'dashboardview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-dashboard-view/task-dashboard-view.vue'),
                },
                {
                    path: 'projects/:project?/tasks/:task?/editview/:editview?',
                    meta: {
                        caption: 'entities.task.views.editview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'projects', parameterName: 'project' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-edit-view/task-edit-view.vue'),
                },
                {
                    path: 'tasks/:task?/editview/:editview?',
                    meta: {
                        caption: 'entities.task.views.editview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'editview', parameterName: 'editview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-edit-view/task-edit-view.vue'),
                },
                {
                    path: 'projects/:project?/prjteammgreditview/:prjteammgreditview?',
                    meta: {
                        caption: 'entities.project.views.prjteammgreditview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'projects', parameterName: 'project' },
                            { pathName: 'prjteammgreditview', parameterName: 'prjteammgreditview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/project-prj-team-mgr-edit-view/project-prj-team-mgr-edit-view.vue'),
                },
                {
                    path: 'projects/:project?/tasks/:task?/myfavoriteslistview/:myfavoriteslistview?',
                    meta: {
                        caption: 'entities.task.views.myfavoriteslistview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'projects', parameterName: 'project' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'myfavoriteslistview', parameterName: 'myfavoriteslistview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-my-favorites-list-view/task-my-favorites-list-view.vue'),
                },
                {
                    path: 'tasks/:task?/myfavoriteslistview/:myfavoriteslistview?',
                    meta: {
                        caption: 'entities.task.views.myfavoriteslistview.caption',
                        info:'',
                        parameters: [
                            { pathName: 'index', parameterName: 'index' },
                            { pathName: 'tasks', parameterName: 'task' },
                            { pathName: 'myfavoriteslistview', parameterName: 'myfavoriteslistview' },
                        ],
                        requireAuth: true,
                    },
                    component: () => import('@pages/pms/task-my-favorites-list-view/task-my-favorites-list-view.vue'),
                },
            ...indexRoutes,
            ],
        },
    {
        path: '/projects/:project?/tasks/:task?/editview/:editview?',
        meta: {
            caption: 'entities.task.views.editview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'editview', parameterName: 'editview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-edit-view/task-edit-view.vue'),
    },
    {
        path: '/tasks/:task?/editview/:editview?',
        meta: {
            caption: 'entities.task.views.editview.caption',
            info:'',
            parameters: [
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'editview', parameterName: 'editview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-edit-view/task-edit-view.vue'),
    },
    {
        path: '/projects/:project?/tasks/:task?/listview/:listview?',
        meta: {
            caption: 'entities.task.views.listview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'listview', parameterName: 'listview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-list-view/task-list-view.vue'),
    },
    {
        path: '/tasks/:task?/listview/:listview?',
        meta: {
            caption: 'entities.task.views.listview.caption',
            info:'',
            parameters: [
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'listview', parameterName: 'listview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-list-view/task-list-view.vue'),
    },
    {
        path: '/projects/:project?/tasks/:task?/myfavoriteslistview/:myfavoriteslistview?',
        meta: {
            caption: 'entities.task.views.myfavoriteslistview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'myfavoriteslistview', parameterName: 'myfavoriteslistview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-my-favorites-list-view/task-my-favorites-list-view.vue'),
    },
    {
        path: '/tasks/:task?/myfavoriteslistview/:myfavoriteslistview?',
        meta: {
            caption: 'entities.task.views.myfavoriteslistview.caption',
            info:'',
            parameters: [
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'myfavoriteslistview', parameterName: 'myfavoriteslistview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-my-favorites-list-view/task-my-favorites-list-view.vue'),
    },
    {
        path: '/projects/:project?/gridview/:gridview?',
        meta: {
            caption: 'entities.project.views.gridview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'gridview', parameterName: 'gridview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/project-grid-view/project-grid-view.vue'),
    },
    {
        path: '/actions/:action?/editview/:editview?',
        meta: {
            caption: 'entities.action.views.editview.caption',
            info:'',
            parameters: [
                { pathName: 'actions', parameterName: 'action' },
                { pathName: 'editview', parameterName: 'editview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/action-edit-view/action-edit-view.vue'),
    },
    {
        path: '/projects/:project?/infodashboardview/:infodashboardview?',
        meta: {
            caption: 'entities.project.views.infodashboardview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'infodashboardview', parameterName: 'infodashboardview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/project-info-dashboard-view/project-info-dashboard-view.vue'),
    },
    {
        path: '/projects/:project?/simpleeditview/:simpleeditview?',
        meta: {
            caption: 'entities.project.views.simpleeditview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'simpleeditview', parameterName: 'simpleeditview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/project-simple-edit-view/project-simple-edit-view.vue'),
    },
    {
        path: '/actions/:action?/taskactionlistview/:taskactionlistview?',
        meta: {
            caption: 'entities.action.views.taskactionlistview.caption',
            info:'',
            parameters: [
                { pathName: 'actions', parameterName: 'action' },
                { pathName: 'taskactionlistview', parameterName: 'taskactionlistview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/action-task-action-list-view/action-task-action-list-view.vue'),
    },
    {
        path: '/projects/:project?/prjteammgreditview/:prjteammgreditview?',
        meta: {
            caption: 'entities.project.views.prjteammgreditview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'prjteammgreditview', parameterName: 'prjteammgreditview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/project-prj-team-mgr-edit-view/project-prj-team-mgr-edit-view.vue'),
    },
    {
        path: '/projects/:project?/tasks/:task?/infodashboardview/:infodashboardview?',
        meta: {
            caption: 'entities.task.views.infodashboardview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'infodashboardview', parameterName: 'infodashboardview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-info-dashboard-view/task-info-dashboard-view.vue'),
    },
    {
        path: '/tasks/:task?/infodashboardview/:infodashboardview?',
        meta: {
            caption: 'entities.task.views.infodashboardview.caption',
            info:'',
            parameters: [
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'infodashboardview', parameterName: 'infodashboardview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-info-dashboard-view/task-info-dashboard-view.vue'),
    },
    {
        path: '/projects/:project?/tasks/:task?/mytasklistview/:mytasklistview?',
        meta: {
            caption: 'entities.task.views.mytasklistview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'mytasklistview', parameterName: 'mytasklistview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-my-task-list-view/task-my-task-list-view.vue'),
    },
    {
        path: '/tasks/:task?/mytasklistview/:mytasklistview?',
        meta: {
            caption: 'entities.task.views.mytasklistview.caption',
            info:'',
            parameters: [
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'mytasklistview', parameterName: 'mytasklistview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-my-task-list-view/task-my-task-list-view.vue'),
    },
    {
        path: '/projects/:project?/tasks/:task?/tabexpview/:tabexpview?',
        meta: {
            caption: 'entities.task.views.tabexpview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'tabexpview', parameterName: 'tabexpview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-tab-exp-view/task-tab-exp-view.vue'),
    },
    {
        path: '/tasks/:task?/tabexpview/:tabexpview?',
        meta: {
            caption: 'entities.task.views.tabexpview.caption',
            info:'',
            parameters: [
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'tabexpview', parameterName: 'tabexpview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-tab-exp-view/task-tab-exp-view.vue'),
    },
    {
        path: '/projects/:project?/tasks/:task?/dashboardview/:dashboardview?',
        meta: {
            caption: 'entities.task.views.dashboardview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'dashboardview', parameterName: 'dashboardview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-dashboard-view/task-dashboard-view.vue'),
    },
    {
        path: '/tasks/:task?/dashboardview/:dashboardview?',
        meta: {
            caption: 'entities.task.views.dashboardview.caption',
            info:'',
            parameters: [
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'dashboardview', parameterName: 'dashboardview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-dashboard-view/task-dashboard-view.vue'),
    },
    {
        path: '/projects/:project?/tasks/:task?/closedgridview/:closedgridview?',
        meta: {
            caption: 'entities.task.views.closedgridview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'closedgridview', parameterName: 'closedgridview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-closed-grid-view/task-closed-grid-view.vue'),
    },
    {
        path: '/tasks/:task?/closedgridview/:closedgridview?',
        meta: {
            caption: 'entities.task.views.closedgridview.caption',
            info:'',
            parameters: [
                { pathName: 'tasks', parameterName: 'task' },
                { pathName: 'closedgridview', parameterName: 'closedgridview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/task-closed-grid-view/task-closed-grid-view.vue'),
    },
    {
        path: '/projects/:project?/editview/:editview?',
        meta: {
            caption: 'entities.project.views.editview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'editview', parameterName: 'editview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/project-edit-view/project-edit-view.vue'),
    },
    {
        path: '/projects/:project?/listview/:listview?',
        meta: {
            caption: 'entities.project.views.listview.caption',
            info:'',
            parameters: [
                { pathName: 'projects', parameterName: 'project' },
                { pathName: 'listview', parameterName: 'listview' },
            ],
            requireAuth: true,
        },
        component: () => import('@pages/pms/project-list-view/project-list-view.vue'),
    },
        ...globalRoutes,
        {
            path: '/login/:login?',
            name: 'login',
            meta: {  
                caption: '登录',
                viewType: 'login',
                requireAuth: false,
                ignoreAddPage: true,
            },
            beforeEnter: (to: any, from: any, next: any) => {
                router.app.$store.commit('resetRootStateData');
                next();
            },
            component: () => import('@components/login/login.vue'),
        },
        {
            path: '/lock',
            name: 'lock',
            meta: {  
                caption: '锁屏',
                viewType: 'lock',
                requireAuth: false,
                ignoreAddPage: true,
            },
            beforeEnter: (to: any, from: any, next: any) => {
                next();
            },
            component: () => import('@components/app-lock/app-lock.vue'),
        },
        {
            path: '/404',
            component: () => import('@components/404/404.vue')
        },
        {
            path: '/500',
            component: () => import('@components/500/500.vue')
        },
        {
            path: '*',
            redirect: 'index'
        },
    ],
});
// 解决路由跳转路由重复时报错
const originalPush = Router.prototype.push
Router.prototype.push = function push(location: any) {
    let result: any = originalPush.call(this, location);
    return result.catch((err: any) => err);
}
export default router;
